package com.wenwen.social.controller;

import com.wenwen.social.application.HomeLineApplication;
import com.wenwen.social.application.dto.MessageDTO;
import com.wenwen.social.application.dto.PageRequest;
import com.wenwen.social.application.dto.PageResult;
import com.wenwen.social.controller.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MyHomeLineController {

	@Autowired
	private HomeLineApplication homeLineApplication;


	/**
	 * 我的主页动态
	 * test：http://localhost:8081/myhomeline?pageNum=1&pageSize=10&uid=4
	 * @param pageNum
	 * @param pageSize
	 * @param uid
	 * @return
	 */
	@RequestMapping("/myhomeline")
	public ResultVO demo(Integer pageNum, Integer pageSize, Long uid) {

		PageRequest pageRequest = new PageRequest();

		pageRequest.setPageNum(pageNum);

		pageRequest.setPageSize(pageSize);

		PageResult<MessageDTO> pageResult = homeLineApplication.queryHomeLineMsg(pageRequest, uid);

		return ResultVO.success(pageResult);
	}

}
